package com.example.i18n;

import org.junit.Test;

import java.util.Locale;
import java.util.ResourceBundle;

public class i18nTest {
    @Test
    public void testLocale(){
//        默认语言
        Locale locale = Locale.getDefault();
        System.out.println(locale);
//        获取中文常量对象
        System.out.println(Locale.CHINA);
    }

    @Test
    public void testI18n(){
        Locale locale = Locale.US;
        ResourceBundle bundle = ResourceBundle.getBundle("i18n", locale);
        System.out.println(bundle.getString("username"));
        System.out.println(bundle.getString("password"));
        System.out.println(bundle.getString("sex"));
        System.out.println(bundle.getString("age"));


    }
}
